<template>
  <div class="form-group" style="">
    <div class="row" style="">
      <div class="col-lg-12">
        <input
          type="button"
          :value="storeGrpText"
          id="storeGrpBtn"
          class="form-control input-sm"
          @click="showStoreGrpModal()"
          style="width: 250px;"
        />
      </div>
    </div>
  </div>
</template>

<script>
import storeGrpModule from "group";

export default {
  name: "menuStoreComponent",
  data: function() {
    return {
      storeGrp_instance : new storeGrpModule(window.$),
      storeGrpText : "店舗選択"
    };
  },
  props: {
  },
  methods: {
    //显示店铺グループ
    showStoreGrpModal() {
      this.storeGrp_instance.show();
    },
    /**
     * 初始化店铺Grp插件
     */
    initStoreGrpModal() {
      // var vm = this;
      var storeGrpModuleParam = {
        usercd: "10154057",
        elementId: "storeGrpBtn",
        groupFlg:'store',
        level: "1-1-1",
        moduleType: "one"
      };
      // if (this.store.time !== "") {
      //   var timeArr = this.store.time.toString().split("~");
      //   storeGrpModuleParam.startTime = timeArr[0];
      //   storeGrpModuleParam.endTime = timeArr[1];
      //   storeGrpModuleParam.timeType = this.store.timeType;
      // } else {
      //   var yTimeDate = new Date(new Date().getTime() - 24 * 60 * 60 * 1000);
      //   var yTime =
      //     "" +
      //     yTimeDate.getFullYear() +
      //     (yTimeDate.getMonth() + 1) +
      //     (yTimeDate.getDate().toString().length < 2
      //       ? "0" + yTimeDate.getDate()
      //       : yTimeDate.getDate());
      //   storeGrpModuleParam.startTime = yTime;
      //   storeGrpModuleParam.endTime = yTime;
      //   storeGrpModuleParam.timeType = "M";
      // }
      this.storeGrp_instance.init(storeGrpModuleParam);
    }
  },
  computed: {
  },
  watch: {
    // "store.value"() {
    //   if (
    //     this.store.value.join(",") !==
    //     this.store_instance.getStoresFav().join(",")
    //   ) {
    //     this.store_instance.setStores({
    //       storeArr: this.store.value,
    //       type: this.store.type
    //     });
    //   }
    // }
  },
  mounted() {
    this.initStoreGrpModal();
  }
};
</script>
